package learn.web.controller;

import learn.domain.User;
import learn.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by sqluogui on 2016/9/13.
 */

@Controller
@RequestMapping("/")
public class IndexController extends BaseController{
    @Autowired
    private UserService userService;
    @RequestMapping("/index")
    public String index(HttpServletRequest request){
        User user = userService.queryUserById(5);
        List<User> userList = userService.queryAllUser();
        request.setAttribute("message","messageyyyy");
        request.setAttribute("user",user);
        request.setAttribute("userList",userList);
        return "index";
    }
}
